import java.io.File;
import java.lang.reflect.Field;

public class Demo3 {
    public static void main(String[] args) throws InterruptedException {
        File f = new File("d:/test.txt");
        boolean ret = f.delete();
        System.out.println("ret = " + ret);

        // 没有返回值,在进程结束之后删除
        // 先执行删除但是要等待5s后进程结束才真正删除
        /*f.deleteOnExit();
        Thread.sleep(5000);
        System.out.println("进程结束!");*/
    }
}
